package com.shanghaionstar.mro;


import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link MrOHelpTemplateFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class MrOHelpTemplateFragment extends MrOBaseFragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String LAYOUT_ID = "layoutId";

    // TODO: Rename and change types of parameters
    private int layoutId;

    private View view;

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param layoutId layoutId
     * @return A new instance of fragment MrOHelpTemplateFragment.
     */
    // TODO: Rename and change types and number of parameters
    public static MrOHelpTemplateFragment newInstance(int layoutId) {
        MrOHelpTemplateFragment fragment = new MrOHelpTemplateFragment();
        Bundle args = new Bundle();
        args.putInt(LAYOUT_ID, layoutId);
        fragment.setArguments(args);
        return fragment;
    }

    public MrOHelpTemplateFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            layoutId = getArguments().getInt(LAYOUT_ID);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (view == null) {
            view = inflater.inflate(layoutId, container, false);
            injectView(view);
        } else {
            super.onResumeView(view);
        }
        return view;
    }


}
